package Productor_customer;

import java.util.concurrent.LinkedBlockingQueue;

public class Customer extends Thread {
    private LinkedBlockingQueue<BaoZi> zt;

    public Customer(LinkedBlockingQueue<BaoZi> zt) {
        this.zt = zt;
    }

    @Override
    public void run() {
        int i=0;
        while (i<5){
            i++;
            try {
            BaoZi bz=zt.take();
            System.out.println(Thread.currentThread().getName()+"吃了"+bz);
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
